home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / sbrkout.c < prev    next >
C/C++ Source or Header  |  2000-05-13  |  9KB  |  289 lines

  1. /***************************************************************************
  2. Atari Super Breakout Driver
  3.  
  4. Note:  I'm cheating a little bit with the paddle control.  The original
  5. game handles the paddle control as following.  The paddle is a potentiometer.
  6. Every VBlank signal triggers the start of a voltage ramp.  Whenever the
  7. ramp has the same value as the potentiometer, an NMI is generated.    In the
  8. NMI code, the current scanline value is used to calculate the value to
  9. put into location $1F in memory.  I cheat in this driver by just putting
  10. the paddle value directly into $1F, which has the same net result.
  11.  
  12. If you have any questions about how this driver works, don't hesitate to
  13. ask.  - Mike Balfour (mab22@po.cwru.edu)
  14.  
  15. CHANGES:
  16. MAB 05 MAR 99 - changed overlay support to use artwork functions
  17. ***************************************************************************/
  18.  
  19. #include "driver.h"
  20. #include "vidhrdw/generic.h"
  21.  
  22. /* vidhrdw/sbrkout.c */
  23. void sbrkout_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  24. int sbrkout_vh_start(void);
  25. extern unsigned char *sbrkout_horiz_ram;
  26. extern unsigned char *sbrkout_vert_ram;
  27.  
  28. /* machine/sbrkout.c */
  29. WRITE_HANDLER( sbrkout_serve_led_w );
  30. WRITE_HANDLER( sbrkout_start_1_led_w );
  31. WRITE_HANDLER( sbrkout_start_2_led_w );
  32. READ_HANDLER( sbrkout_read_DIPs_r );
  33. extern int sbrkout_interrupt(void);
  34. READ_HANDLER( sbrkout_select1_r );
  35. READ_HANDLER( sbrkout_select2_r );
  36.  
  37.  
  38. /* sound hardware - temporary */
  39.  
  40. static WRITE_HANDLER( sbrkout_dac_w );
  41. static void sbrkout_tones_4V(int foo);
  42. static int init_timer=1;
  43.  
  44. #define TIME_4V 4.075/4
  45.  
  46. unsigned char *sbrkout_sound;
  47.  
  48. static WRITE_HANDLER( sbrkout_dac_w )
  49. {
  50.     sbrkout_sound[offset]=data;
  51.  
  52.     if (init_timer)
  53.     {
  54.         timer_set (TIME_IN_MSEC(TIME_4V), 0, sbrkout_tones_4V);
  55.         init_timer=0;
  56.     }
  57. }
  58.  
  59. static void sbrkout_tones_4V(int foo)
  60. {
  61.     static int vlines=0;
  62.  
  63.     if ((*sbrkout_sound) & vlines)
  64.         DAC_data_w(0,255);
  65.     else
  66.         DAC_data_w(0,0);
  67.  
  68.     vlines = (vlines+1) % 16;
  69.  
  70.     timer_set (TIME_IN_MSEC(TIME_4V), 0, sbrkout_tones_4V);
  71. }
  72.  
  73.  
  74. static struct MemoryReadAddress readmem[] =
  75. {
  76.     { 0x001f, 0x001f, input_port_6_r }, /* paddle value */
  77.     { 0x0000, 0x00ff, MRA_RAM }, /* Zero Page RAM */
  78.     { 0x0100, 0x01ff, MRA_RAM }, /* ??? */
  79.     { 0x0400, 0x077f, MRA_RAM }, /* Video Display RAM */
  80.     { 0x0828, 0x0828, sbrkout_select1_r }, /* Select 1 */
  81.     { 0x082f, 0x082f, sbrkout_select2_r }, /* Select 2 */
  82.     { 0x082e, 0x082e, input_port_5_r }, /* Serve Switch */
  83.     { 0x0830, 0x0833, sbrkout_read_DIPs_r }, /* DIP Switches */
  84.     { 0x0840, 0x0840, input_port_1_r }, /* Coin Switches */
  85.     { 0x0880, 0x0880, input_port_2_r }, /* Start Switches */
  86.     { 0x08c0, 0x08c0, input_port_3_r }, /* Self Test Switch */
  87.     { 0x0c00, 0x0c00, input_port_4_r }, /* Vertical Sync Counter */
  88.     { 0x2c00, 0x3fff, MRA_ROM }, /* PROGRAM */
  89.     { 0xfff0, 0xffff, MRA_ROM }, /* PROM8 for 6502 vectors */
  90.     { -1 }    /* end of table */
  91. };
  92.  
  93. static struct MemoryWriteAddress writemem[] =
  94. {
  95.     { 0x0011, 0x0011, sbrkout_dac_w, &sbrkout_sound }, /* Noise Generation Bits */
  96.     { 0x0010, 0x0014, MWA_RAM, &sbrkout_horiz_ram }, /* Horizontal Ball Position */
  97.     { 0x0018, 0x001d, MWA_RAM, &sbrkout_vert_ram }, /* Vertical Ball Position / ball picture */
  98.     { 0x0000, 0x00ff, MWA_RAM }, /* WRAM */
  99.     { 0x0100, 0x01ff, MWA_RAM }, /* ??? */
  100.     { 0x0400, 0x07ff, videoram_w, &videoram, &videoram_size }, /* DISPLAY */
  101. //    { 0x0c10, 0x0c11, sbrkout_serve_led_w }, /* Serve LED */
  102.     { 0x0c30, 0x0c31, sbrkout_start_1_led_w }, /* 1 Player Start Light */
  103.     { 0x0c40, 0x0c41, sbrkout_start_2_led_w }, /* 2 Player Start Light */
  104.     { 0x0c50, 0x0c51, MWA_RAM }, /* NMI Pot Reading Enable */
  105.     { 0x0c70, 0x0c71, MWA_RAM }, /* Coin Counter */
  106.     { 0x0c80, 0x0c80, MWA_NOP }, /* Watchdog */
  107.     { 0x0e00, 0x0e00, MWA_NOP }, /* IRQ Enable? */
  108.     { 0x1000, 0x1000, MWA_RAM }, /* LSB of Pot Reading */
  109.     { 0x2c00, 0x3fff, MWA_ROM }, /* PROM1-PROM8 */
  110.     { -1 }    /* end of table */
  111. };
  112.  
  113. INPUT_PORTS_START( sbrkout )
  114.     PORT_START        /* DSW - fake port, gets mapped to Super Breakout ports */
  115.     PORT_DIPNAME( 0x03, 0x00, "Language" )
  116.     PORT_DIPSETTING(    0x00, "English" )
  117.     PORT_DIPSETTING(    0x01, "German" )
  118.     PORT_DIPSETTING(    0x02, "French" )
  119.     PORT_DIPSETTING(    0x03, "Spanish" )
  120.     PORT_DIPNAME( 0x0C, 0x08, DEF_STR( Coinage ) )
  121.     PORT_DIPSETTING(    0x0C, DEF_STR( 2C_1C ) )
  122.     PORT_DIPSETTING(    0x08, DEF_STR( 1C_1C ) )
  123.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_2C ) )
  124.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  125.     PORT_DIPNAME( 0x70, 0x00, "Extended Play" ) /* P=Progressive, C=Cavity, D=Double */
  126.     PORT_DIPSETTING(    0x10, "200P/200C/200D" )
  127.     PORT_DIPSETTING(    0x20, "400P/300C/400D" )
  128.     PORT_DIPSETTING(    0x30, "600P/400C/600D" )
  129.     PORT_DIPSETTING(    0x40, "900P/700C/800D" )
  130.     PORT_DIPSETTING(    0x50, "1200P/900C/1000D" )
  131.     PORT_DIPSETTING(    0x60, "1600P/1100C/1200D" )
  132.     PORT_DIPSETTING(    0x70, "2000P/1400C/1500D" )
  133.     PORT_DIPSETTING(    0x00, "None" )
  134.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Lives ) )
  135.     PORT_DIPSETTING(    0x80, "3" )
  136.     PORT_DIPSETTING(    0x00, "5" )
  137.  
  138.     PORT_START        /* IN0 */
  139.     PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_COIN1 )
  140.     PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_COIN2 )
  141.  
  142.     PORT_START        /* IN1 */
  143.     PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_START1 )
  144.     PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_START2 )
  145.  
  146.     PORT_START        /* IN2 */
  147.     PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_TILT )
  148.     PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
  149.  
  150.     PORT_START        /* IN3 */
  151.     PORT_BIT ( 0xFF, IP_ACTIVE_LOW, IPT_VBLANK )
  152.  
  153.     PORT_START        /* IN4 */
  154.     PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  155.  
  156.     PORT_START        /* IN5 */
  157.     PORT_ANALOG( 0xff, 0x00, IPT_PADDLE | IPF_REVERSE, 50, 10, 0, 255 )
  158.  
  159.     PORT_START        /* IN6 - fake port, used to set the game select dial */
  160.     PORT_BITX(0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN, "Progressive", KEYCODE_E, IP_JOY_NONE )
  161.     PORT_BITX(0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN, "Double", KEYCODE_D, IP_JOY_NONE )
  162.     PORT_BITX(0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN, "Cavity", KEYCODE_C, IP_JOY_NONE )
  163. INPUT_PORTS_END
  164.  
  165.  
  166. static struct GfxLayout charlayout =
  167. {
  168.     8,8,    /* 8*8 characters */
  169.     64,     /* 64 characters */
  170.     1,        /* 1 bit per pixel */
  171.     { 0 },          /* no separation in 1 bpp */
  172.     { 4, 5, 6, 7, 0x200*8 + 4, 0x200*8 + 5, 0x200*8 + 6, 0x200*8 + 7 },
  173.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  174.     8*8 /* every char takes 8 consecutive bytes */
  175. };
  176.  
  177. static struct GfxLayout balllayout =
  178. {
  179.     3,3,    /* 3*3 character? */
  180.     2,        /* 2 characters */
  181.     1,        /* 1 bit per pixel */
  182.     { 0 },    /* no separation in 1 bpp */
  183.     { 0, 1, 2 },
  184.     { 0*8, 1*8, 2*8 },
  185.     3*8 /* every char takes 3 consecutive byte */
  186. };
  187.  
  188. static struct GfxDecodeInfo gfxdecodeinfo[] =
  189. {
  190.     { REGION_GFX1, 0, &charlayout, 0, 2 },
  191.     { REGION_GFX2, 0, &balllayout, 0, 2 },
  192.     { -1 } /* end of array */
  193. };
  194.  
  195. static unsigned char palette[] =
  196. {
  197.     0x00,0x00,0x00, /* BLACK  */
  198.     0xff,0xff,0xff, /* WHITE  */
  199. };
  200.  
  201. #define ARTWORK_COLORS (2 + 32768)
  202.  
  203. static unsigned short colortable[ARTWORK_COLORS] =
  204. {
  205.     0, 0,  /* Don't draw */
  206.     0, 1,  /* Draw */
  207. };
  208.  
  209. static void init_palette(unsigned char *game_palette, unsigned short *game_colortable,const unsigned char *color_prom)
  210. {
  211.     memcpy(game_palette,palette,sizeof(palette));
  212.     memcpy(game_colortable,colortable,sizeof(colortable));
  213. }
  214.  
  215.  
  216. static struct DACinterface dac_interface =
  217. {
  218.     1,
  219.     { 100 }
  220. };
  221.  
  222.  
  223.  
  224. static struct MachineDriver machine_driver_sbrkout =
  225. {
  226.     /* basic machine hardware */
  227.     {
  228.         {
  229.             CPU_M6502,
  230.             375000,        /* 375 KHz? Should be 750KHz? */
  231.             readmem,writemem,0,0,
  232.             sbrkout_interrupt,1
  233.         }
  234.     },
  235.     60, DEFAULT_REAL_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  236.     1,    /* single CPU, no need for interleaving */
  237.     0,
  238.  
  239.     /* video hardware */
  240.     32*8, 28*8, { 0*8, 32*8-1, 0*8, 28*8-1 },
  241.     gfxdecodeinfo,
  242.     ARTWORK_COLORS,ARTWORK_COLORS,        /* Declare extra colors for the overlay */
  243.     init_palette,
  244.  
  245.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  246.     0,
  247.     sbrkout_vh_start,
  248.     generic_vh_stop,
  249.     sbrkout_vh_screenrefresh,
  250.  
  251.     /* sound hardware */
  252.     0,0,0,0,
  253.     {
  254.         {
  255.             SOUND_DAC,
  256.             &dac_interface
  257.         }
  258.     }
  259. };
  260.  
  261.  
  262.  
  263.  
  264.  
  265. /***************************************************************************
  266.  
  267.   Game driver(s)
  268.  
  269. ***************************************************************************/
  270.  
  271. ROM_START( sbrkout )
  272.     ROM_REGION( 0x10000, REGION_CPU1 ) /* 64k for code */
  273.     ROM_LOAD( "033453.c1",    0x2800, 0x0800, 0xa35d00e3 )
  274.     ROM_LOAD( "033454.d1",    0x3000, 0x0800, 0xd42ea79a )
  275.     ROM_LOAD( "033455.e1",    0x3800, 0x0800, 0xe0a6871c )
  276.     ROM_RELOAD(               0xf800, 0x0800 )
  277.  
  278.     ROM_REGION( 0x0400, REGION_GFX1 | REGIONFLAG_DISPOSE )
  279.     ROM_LOAD( "033280.p4",    0x0000, 0x0200, 0x5a69ce85 )
  280.     ROM_LOAD( "033281.r4",    0x0200, 0x0200, 0x066bd624 )
  281.  
  282.     ROM_REGION( 0x0020, REGION_GFX2 | REGIONFLAG_DISPOSE )
  283.     ROM_LOAD( "033282.k6",    0x0000, 0x0020, 0x6228736b )
  284. ROM_END
  285.  
  286.  
  287.  
  288. GAME( 1978, sbrkout, 0, sbrkout, sbrkout, 0, ROT270, "Atari", "Super Breakout" )
  289.